﻿using System.Configuration;
using System.Xml;
using System.Xml.Serialization;

namespace HobSoft.SoccerBet2014.Domain.Configuration
{
    [XmlRoot("bookmaker.schedule")]
    public class ScheduleSettingConfiguration : IConfigurationSectionHandler
    {
        [XmlElement("schedule")]
        public ScheduleConfiguration[] SiteBmConfiguration { get; set; }
        public object Create(object parent, object configContext, XmlNode section)
        {
            XmlSerializer ser = new XmlSerializer(typeof(ScheduleSettingConfiguration));
            return ser.Deserialize(new XmlNodeReader(section));
        }
    }

    [XmlRoot("schedule")]
    public class ScheduleConfiguration
    {
        private byte _bmId;
        [XmlAttribute("bm-id")]
        public byte BmID
        {
            get { return _bmId; }
            set { _bmId = value; }
        }

        private int _timerInterval;
        [XmlAttribute("timer")]
        public int TimerInterval
        {
            get { return _timerInterval; }
            set { _timerInterval = value; }
        }
        
        private int _liveCountdown;
        [XmlAttribute("live.countdown")]
        public int LiveCountdown
        {
            get { return _liveCountdown; }
            set { _liveCountdown = value; }
        }

        private int _liveResetInterval;
        [XmlAttribute("live.reset")]
        public int LiveResetInterval
        {
            get { return _liveResetInterval; }
            set { _liveResetInterval = value; }
        }

        private int _todayCountdown;
        [XmlAttribute("today.countdown")]
        public int TodayCountdown
        {
            get { return _todayCountdown; }
            set { _todayCountdown = value; }
        }

        private int _todayResetInterval;
        [XmlAttribute("today.reset")]
        public int TodayResetInterval
        {
            get { return _todayResetInterval; }
            set { _todayResetInterval = value; }
        }

        private int _earlyCountdown;
        [XmlAttribute("early.countdown")]
        public int EarlyCountdown
        {
            get { return _earlyCountdown; }
            set { _earlyCountdown = value; }
        }

    }
}
